home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 117 / PC Guia 117.iso / Software / Produtividade / Software3 / Product4 / Data1.cab / _5B6540273FC04DC89EE99063D8E8C75E < prev    next >
Encoding:
Text File  |  2004-10-19  |  8.0 KB  |  243 lines

  1. /*******************************************************************/
  2. /*                                                                 */
  3. /*                      ADOBE CONFIDENTIAL                         */
  4. /*                   _ _ _ _ _ _ _ _ _ _ _ _ _                     */
  5. /*                                                                 */
  6. /* Copyright 2004 Adobe Systems Incorporated                       */
  7. /* All Rights Reserved.                                            */
  8. /*                                                                 */
  9. /* NOTICE:  All information contained herein is, and remains the   */
  10. /* property of Adobe Systems Incorporated and its suppliers, if    */
  11. /* any.  The intellectual and technical concepts contained         */
  12. /* herein are proprietary to Adobe Systems Incorporated and its    */
  13. /* suppliers and may be covered by U.S. and Foreign Patents,       */
  14. /* patents in process, and are protected by trade secret or        */
  15. /* copyright law.  Dissemination of this information or            */
  16. /* reproduction of this material is strictly forbidden unless      */
  17. /* prior written permission is obtained from Adobe Systems         */
  18. /* Incorporated.                                                   */
  19. /*                                                                 */
  20. /*******************************************************************/
  21.  
  22.  
  23. /*
  24. **-----------------------------------------------------------------------------
  25. ** Effect File Variables
  26. **-----------------------------------------------------------------------------
  27. */
  28.  
  29. uniform float4x4    gWorldViewProj : WorldViewProjection; // This matrix will be loaded by the application
  30. uniform float4x4    gWorldViewInverse;
  31. uniform float4x4    gWorldView;
  32. uniform float4        gLightPosition;
  33. uniform float4        gSinCosLookup;
  34. uniform float        gAspectRatio;
  35. uniform float        gAnchorX;
  36. uniform float4        gEyePosition;
  37. texture                gVideoTexture;
  38.  
  39. /*
  40. **-----------------------------------------
  41. **        Sampler States
  42. **-----------------------------------------
  43. */
  44. //incoming video texture
  45. sampler Sampler = sampler_state
  46. {
  47.     Texture   = (gVideoTexture);
  48.     MipFilter = LINEAR;
  49.     MinFilter = LINEAR;
  50.     MagFilter = LINEAR;
  51. };
  52.  
  53. /*
  54. **-----------------------------------------------------------------------------
  55. ** Vertex Definitions
  56. **-----------------------------------------------------------------------------
  57. ** APP_OUTPUT is the structure in which we receive the vertices from the application
  58. */
  59. struct APP_OUTPUT
  60. {
  61.     float3 mPosition    : POSITION;
  62.     float3 mNormal        : NORMAL;
  63.     float2 mTexCoord    : TEXCOORD0;
  64. };
  65.  
  66. /* 
  67. ** Pixel Shader structure declaration (for Foreground mesh)
  68. */
  69.  
  70. struct VS_OUTPUT 
  71. {
  72.     float4 mHPosition        : POSITION;        // coord position in window
  73.     float2 mTexcoord        : TEXCOORD0;    // wavy or fleck map texture coordinates
  74.     float3 mLightVec        : TEXCOORD1;        // position of light relative to point
  75.     float3 mHalfVec            : TEXCOORD2;        // Blinn halfangle
  76.     float3 mNormal            : TEXCOORD3;
  77. };
  78.  
  79. /* 
  80. ** Pixel Shader structure declaration (for background mesh)
  81. */
  82. struct PLAIN_VS_OUTPUT 
  83. {
  84.     float4 mHPosition        : POSITION;        // coord position in window
  85.     float2 mTexcoord        : TEXCOORD0;    // wavy or fleck map texture coordinates
  86. };
  87.  
  88. /*
  89. ** TEMP_OUT is a temporary structure for the DoCylCurl function
  90. */
  91. struct TEMP_OUT
  92. {
  93.     float4 mPosition    : POSITION;
  94.     float3 mNormal        : NORMAL0;
  95.     float3 mTangent;
  96.     float3 mBinormal;
  97. };
  98.  
  99. /*
  100. **------------------------------------------------
  101. ** Cylindrical Curl effect(for Foreground mesh)
  102. **------------------------------------------------
  103. */
  104. TEMP_OUT DoCylCurl( float3 position )
  105. {
  106.     TEMP_OUT returnVertex;
  107.     float sinVal, cosVal, curlRadius;
  108.     float3x3 forwardMat, InvMat;
  109.  
  110.     sinVal = gSinCosLookup.x;
  111.     cosVal = gSinCosLookup.y;
  112.     forwardMat = float3x3( float3(cosVal, sinVal, 0.0), float3(-sinVal, cosVal, 0.0), float3(0,0,1) );
  113.  
  114.     sinVal = gSinCosLookup.z;
  115.     cosVal = gSinCosLookup.w;
  116.     InvMat = float3x3( float3(cosVal, sinVal, 0.0), float3(-sinVal, cosVal, 0.0), float3(0,0,1) );
  117.     
  118.     position = mul( forwardMat, position );
  119.     returnVertex.mPosition.xyz = position;
  120.     returnVertex.mPosition.w = 1.0f;
  121.     
  122.     returnVertex.mNormal = float3( 0.0f, 0.0f, 1.0f );
  123.     returnVertex.mBinormal = float3( 0, 1.0, 0 );    
  124.     
  125.     if ( position.x > gAnchorX )
  126.     {
  127.         //radius = 2/pi - factor*(distance to anchor)
  128.         curlRadius = 0.25f - 0.2*( position.x - gAnchorX );
  129.         float angle = ( position.x - gAnchorX )/curlRadius; // dist/Radius of curl
  130.         sincos( angle, sinVal, cosVal );
  131.         returnVertex.mPosition.x = gAnchorX + sinVal*curlRadius; // gAnchorX + R*SinVal
  132.         returnVertex.mNormal = float3( -sinVal, 0, abs(cosVal) );
  133.         returnVertex.mPosition.z = -0.25f + curlRadius*cosVal;
  134.     }
  135.     
  136.     returnVertex.mPosition.xyz = mul( InvMat, returnVertex.mPosition.xyz );
  137.     returnVertex.mBinormal = mul( InvMat, returnVertex.mBinormal );
  138.     returnVertex.mNormal = mul( InvMat, returnVertex.mNormal );
  139.     returnVertex.mTangent = cross( returnVertex.mBinormal, returnVertex.mNormal );
  140.         
  141.     return returnVertex;
  142. }
  143.  
  144.  
  145. /*
  146. **-------------------------------------------------------------------------
  147. ** Center Peel Transition effect - Vertex Shader(for Foreground mesh)
  148. **-------------------------------------------------------------------------
  149. */
  150. VS_OUTPUT center_peel_transition_vs(APP_OUTPUT In)
  151. {
  152.     VS_OUTPUT Out;
  153.  
  154.     // copy texture coordinates
  155.     Out.mTexcoord.xy = In.mTexCoord.xy;
  156.     
  157.     TEMP_OUT tempVertex = DoCylCurl(float3(In.mPosition.x*gAspectRatio,In.mPosition.yz));
  158.     
  159.     // transform vertex position into homogenous clip-space
  160.     Out.mHPosition = mul(gWorldViewProj, tempVertex.mPosition);
  161.     
  162.     // store normalized light vector
  163.     Out.mLightVec = gLightPosition.xyz;
  164.     
  165.     //compute the half vector    
  166.     float4 eyePos = float4(0.0, 0.0, 1.5, 0.0);
  167.     Out.mHalfVec = normalize(Out.mLightVec + eyePos);
  168.     Out.mNormal = tempVertex.mNormal;
  169.     
  170.     Out.mHalfVec.z = dot( tempVertex.mNormal, Out.mHalfVec );
  171.     
  172.     return Out;
  173. }
  174. /*
  175. **-------------------------------------------------------------------------
  176. ** Center Peel Transition effect - pixel Shader 1_3(for Foreground mesh)
  177. **-------------------------------------------------------------------------
  178. */
  179.  
  180. float4 center_peel_transition_ps_1_3(VS_OUTPUT In) : COLOR
  181. {   
  182.     float4 outColor, color1;
  183.     float diffuse, specular;
  184.     
  185.     color1 = tex2D( Sampler, In.mTexcoord );
  186.     
  187.     diffuse = dot ( In.mNormal, In.mLightVec );
  188.     specular = In.mHalfVec.z;
  189.     specular *= specular;
  190.     specular *= specular;
  191.     specular *= specular;
  192.     
  193.     outColor.xyz = color1*(diffuse)*0.55f + (specular)*color1*float3(0.45,0.45,0.45);
  194.     outColor.a = color1.a;
  195.     
  196.     return outColor;
  197. }
  198. /*
  199. **-------------------------------------------------------------------------
  200. ** Center Peel Transition effect - Plain Vertex Shader(for background mesh)
  201. **-------------------------------------------------------------------------
  202. */
  203. PLAIN_VS_OUTPUT center_peel_transition_vs_plain(APP_OUTPUT In)
  204. {
  205.     PLAIN_VS_OUTPUT Out;
  206.  
  207.     // copy texture coordinates
  208.     Out.mTexcoord.xy = In.mTexCoord.xy;
  209.     
  210.     // transform vertex position into homogenous clip-space
  211.     Out.mHPosition = mul(gWorldViewProj,float4(In.mPosition.x*gAspectRatio,In.mPosition.y,In.mPosition.z,1.0f));
  212.     
  213.     return Out;
  214. }
  215. /*
  216. **-------------------------------------------------------------------------
  217. ** Center Peel Transition effect - plain pixel Shader 1_3(for background mesh)
  218. **-------------------------------------------------------------------------
  219. */
  220.  
  221. float4 center_peel_transition_ps_1_3_plain(PLAIN_VS_OUTPUT In) : COLOR
  222. {   
  223.     float4 color1 = tex2D( Sampler, In.mTexcoord );
  224.     return color1;
  225. }
  226.  
  227. technique center_peel_transition_1_3
  228. {
  229.     pass Pass0 //(for background mesh)
  230.     {
  231.         Sampler[0] = (Sampler); 
  232.         VertexShader = compile vs_1_1 center_peel_transition_vs_plain();
  233.         PixelShader  = compile ps_1_3 center_peel_transition_ps_1_3_plain();
  234.     }
  235.     
  236.     pass Pass1 //(for Foreground mesh)
  237.     {
  238.         Sampler[0] = (Sampler); 
  239.         VertexShader = compile vs_1_1 center_peel_transition_vs();
  240.         PixelShader  = compile ps_1_3 center_peel_transition_ps_1_3();
  241.     }
  242. }
  243.